def maxVowels(s, k):
    vowels = {'a', 'e', 'i', 'o', 'u'}
    res, count = 0, 0
    for i in range(k):
        if s[i] in vowels:
            count += 1
    res = max(res, count)
    for i in range(k, len(s)):
        if s[i - k] in vowels:
            count -= 1
        if s[i] in vowels:
            count += 1
        res = max(res, count)
    return res


s = "abciiidef"
k = 3
print(maxVowels(s, k))  # 3
